﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
					xmlns:controls="clr-namespace:CBR.Components.Controls">

	<!--Spinner Style-->
	<Style x:Key="{x:Type controls:SpinBox}" TargetType="{x:Type controls:SpinBox}">
		<Setter Property="MinHeight" Value="22"/>
		<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
		<Setter Property="Background" Value="{DynamicResource CbrTextBoxBackground}"/>
		<Setter Property="Foreground" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="BorderBrush" Value="{DynamicResource CbrForegroundBrush}"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type controls:SpinBox}">
					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto"/>
							<ColumnDefinition Width="*"/>
						</Grid.ColumnDefinitions>
						<Border x:Name="border" BorderThickness="0" Grid.ColumnSpan="1" Grid.Column="1"
								Background="{TemplateBinding Background}" >
							<Grid Grid.ColumnSpan="1" Grid.Column="1">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="*"/>
									<ColumnDefinition Width="17"/>
								</Grid.ColumnDefinitions>
								<Grid.RowDefinitions>
									<RowDefinition Height="*"/>
									<RowDefinition Height="*"/>
								</Grid.RowDefinitions>
								<TextBox x:Name="PART_TextBox" VerticalAlignment="Center"
										CaretBrush="{TemplateBinding Foreground}"
										 BorderThickness="0" Grid.RowSpan="2" Grid.Column="0" 
										 Background="{TemplateBinding Background}" 
										 Foreground="{TemplateBinding Foreground}" Padding="2,0,2,0" Margin="0" />
								<RepeatButton x:Name="PART_ButtonUp" Grid.Column="1" Grid.Row="0" Style="{DynamicResource CbrRepeatButton}" HorizontalAlignment="Stretch">
									<Path Width="5" Height="3" Fill="{TemplateBinding BorderBrush}" Stretch="Fill" 
										  Stroke="{TemplateBinding BorderBrush}" Data="M0,0L1,-1 2,0" HorizontalAlignment="Center" StrokeThickness="0"
										  VerticalAlignment="Center" Margin="1,2,0,1"  RenderOptions.EdgeMode="Aliased"/>
								</RepeatButton>
								<RepeatButton x:Name="PART_ButtonDown" Grid.Column="1" Grid.Row="1" Style="{DynamicResource CbrRepeatButton}" >
									<Path Width="5" Height="3" Fill="{TemplateBinding BorderBrush}" Stretch="Fill" 
										  Stroke="{TemplateBinding BorderBrush}" Data="M0,0L1,1 2,0" StrokeThickness="0" HorizontalAlignment="Center" 
										  Margin="1,-1,0,0" VerticalAlignment="Center" RenderOptions.EdgeMode="Aliased"/>
								</RepeatButton>
							</Grid>
						</Border>
					</Grid>

					<ControlTemplate.Triggers>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="IsEnabled" TargetName="PART_TextBox" Value="False"/>
							<Setter Property="Background" Value="{DynamicResource CbrBackgroundDisabledBrush}"/>
						</Trigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="Background" Value="{DynamicResource CbrTextBoxBackgroundSelected}"/>
						</Trigger>
						<Trigger Property="IsFocused" Value="true">
							<Setter Property="Background" Value="{DynamicResource CbrTextBoxBackgroundSelected}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
</ResourceDictionary>